<?php
//require_once "../../vendor/autoload.php";
//require_once DOXCX_FRAME_PATH . '/fun/EloquentModels/EloquentModels.php';

$uid = Session::get('mainuid');
//$user = User::where('id', $uid)->first();
//$balance = $user->balance;// 余额
//
//$recordList = UserRechargeRecord::where('user_id', $uid)->orderBy('id', 'desc')->get()->toArray();
$p = new \Pagination();	 
$user = (new Model("user"))->find($uid);
$balance =$user->balance;
$recordList = $p->model_list((new Model("user_recharge_record"))->where(['user_id'=>$uid])->order('id desc'),true);
// dump($recordList);die;
// $recordList = (new Model('user_recharge_record'))->where(['user_id'=>$uid])->order('id desc')->list_all_array();
$mary = array_column((new Model('user_recharge_record'))->where(['user_id'=>$uid,"type"=>2])->field("money")->list_all_array(),"money");
$marys = array_column((new Model('user_recharge_record'))->where(['user_id'=>$uid,"type"=>1])->field("money")->list_all_array(),"money");
$pay = array_sum($mary);
$up = array_sum($marys);